package catalina.container;

import catalina.connection.HttpProtocolUtil;
import catalina.connection.Request;
import catalina.connection.Response;

public class TestServlet extends HttpServlet {

    @Override
    public void doGet(Request request, Response response) {
        String content = "<h1>demo1--LagouServlet get</h1>";
        String header = HttpProtocolUtil.getHttpHeader200((long)content.getBytes().length);
        response.setData(header + content);
    }

    @Override
    public void doPost(Request request, Response response) {
        String content = "<h1>demo1--LagouServlet post</h1>";
        String header = HttpProtocolUtil.getHttpHeader200((long)content.getBytes().length);
        response.setData(header + content);
    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }
}
